<!-- 

	Language Settings
	Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
	
	$Id: settingsGlobalLanguage.html 595 2015-04-17 09:50:36Z imoore76 $

 -->
<table style='width: auto; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
<tr>
<td style='text-align: left'><span class='translate'>Interface Language:</span></td>
</tr>
<tr>
<td>
	<div style='width: 100%; height: 100%;'>
		<ul id='vboxLanguageList' class='vboxBordered vboxList vboxHover'>
			<li class='vboxListItem'>Default</li>
		</ul>
		<div id='vboxLanguageName' style='text-align: center; padding: 4px;'></div>
	</div>
</td>
</tr>
</table>
<script type='text/javascript'>

/* Fill Languages */
var vboxLanguages = [
	{'id':'en','name':'English'},
	{'id':'pt_br','name':'Portuguese (Brazil)','name_tr':'Português (Brasil)'},
	{'id':'ru','name':'Russian','name_tr':'Русский'},
	{'id':'it','name':'Italian','name_tr':'Italiano'},
	{'id':'fr','name':'French','name_tr':'Français'},
	{'id':'de','name':'German','name_tr':'Deutsch'},
	{'id':'es','name':'Spanish','name_tr':'Español'},
	{'id':'ja','name':'Japanese','name_tr':'日本語'},
	{'id':'pl','name':'Polish','name_tr':'Polski'},
	{'id':'zh_cn','name':'Chinese (China)','name_tr':'简体中文 (中国)'},
	{'id':'zh_tw','name':'Traditional Chinese','name_tr':'正體中文'},
	{'id':'ro','name':'Romanian','name_tr':'Română'},
	{'id':'nl','name':'Dutch','name_tr':'Nederlands (Nederland)'},
	{'id':'cs','name':'Czech','name_tr':'čeština'},
];
var lList = $('#vboxLanguageList'); 
$(lList).children().remove();
var defLang = __vboxLangName;
if (!defLang) defLang = 'en';
for(var i = 0; i < vboxLanguages.length; i++) {
	
	var li = $('<li />').data({'language':vboxLanguages[i]}).html((vboxLanguages[i].name_tr ? vboxLanguages[i].name_tr : vboxLanguages[i].name)).attr('class','vboxListItem').hoverClass("vboxHover");
	
	if(defLang == vboxLanguages[i].id) {
		$(li).addClass('vboxListItemSelected');
		$('#vboxLanguageName').html(vboxLanguages[i].name + (vboxLanguages[i].name_tr ? (' / ' + vboxLanguages[i].name_tr) : ''));
	}
	$(li).click(function(){
		$(this).addClass('vboxListItemSelected').siblings().removeClass('vboxListItemSelected');
		$('#vboxLanguageName').html($(this).data('language').name + ($(this).data('language').name_tr ? (' / ' + $(this).data('language').name_tr) : ''));
	});
	$(lList).append(li);
}

/* 
 * 
 * Update Data onSave() 
 * 
 */
$('#vboxSettingsDialog').on('save',function(){
	var lang = $('#vboxLanguageList').children('li.vboxListItemSelected').first().data('language');
	if(!lang) return;
	$('#vboxSettingsDialog').data('language', lang.id);
});
</script>
